<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
	xmlns:f="http://xmlns.jcp.org/jsf/core"
	xmlns:h="http://xmlns.jcp.org/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
	template="/WEB-INF/templates/default.xhtml">

	<f:metadata>
		<f:viewParam name="bulletinId" value="#{bulletinHome3.id}"></f:viewParam>
		<f:event listener="#{bulletinHome3.initConversation()}" type="preRenderView"></f:event>
		<f:viewParam name="moduleName" value="公告查看"></f:viewParam>
	</f:metadata>
	<ui:define name="head">
		<style type="text/css">
	.removeButton {
		float: right;
		margin-right: 20px;
	}
	
	.limitUnit {
		margin-top: 5px;
	}
	
	h2 {
		text-align: center
	}
	
	.rowStyle {
		text-align: center;
		font-size: 16px
	}
</style>
	</ui:define>
	<ui:define name="content">

		<h:form id="viewForm">
			<p:panel id="panel" header="公告信息" style="margin-bottom:10px;">
				<ui:include src="../template/include/bulletinInfo.xhtml" />
			</p:panel>
	
			<p:panel
				id="photos"
				header="交易申请表"
				style="margin-bottom:10px;">
					<div id="imgsPreview" >
						<p:repeat
							var="_photo"
							value="#{bulletinHome3.instance.photos}"
						>
							<img  data-original="#{attachmentUtils.getFullPath(_photo)}" src="#{attachmentUtils.getFullPath(_photo)}"  width="240"/>
						</p:repeat>
					</div>	
			</p:panel>
			<ui:include src="../template/include/bulletinReqInfo.xhtml" />
			<p:panel header="相关附件">	
				 <ui:include src="/WEB-INF/templates/include/bulletinAttachments.xhtml" />
			</p:panel>
			<p:panel id="selecteSupplier" header="已选取的中介"
				rendered="#{not empty bulletinHome3.instance.successTrade}"
				style="margin-bottom:10px;">
				<p:outputLabel for="supplier" value="中介名称：" style="margin:5px 10px"></p:outputLabel>
				<h:outputText id="supplier"
					value="#{bulletinHome3.instance.successTrade.supplier.cnname}" />
				<h:outputText rendered="#{(bulletinHome3.instance.wayOfChoose eq 'Average' or bulletinHome3.instance.wayOfChoose eq 'Price') &amp;&amp; bulletinHome3.instance.tradeStatus eq 'Agreed'}"
							  value="#{bulletinHome3.instance.agreedPrice}"
							  style="margin-left:10px;color: red; font-size: 1.2em; font-weight: bold;"
				/>

			</p:panel>
			<c:set var="discardRecords" value="#{bulletinDiscardRecordService.getRecordsByBulletinId(bulletinHome3.id)}" />
			<p:panel  header="重新选取（作废）历史记录"
				rendered="#{discardRecords.size() > 0}"
				style="margin-bottom:10px;">
				<p:dataTable value="#{discardRecords}" var="_rec">
					<p:column>
						<f:facet name="header" >作废原因</f:facet>
						#{_rec.reason}
					</p:column>
					<p:column>
						<f:facet name="header" >废除中介</f:facet>
						#{_rec.formerSupplierName}
					</p:column>
					<p:column rendered="#{bulletinHome3.instance.wayOfChoose != 'Random'}">
						<f:facet name="header" >顺延中介</f:facet>
						#{_rec.successSupplierName}
					</p:column>
					<p:column>
						<f:facet name="header" >作废时间</f:facet>
						<h:outputText value="#{_rec.createDate}" >
							<f:convertDateTime pattern="yyyy-MM-dd HH:mm:ss"/>
						</h:outputText>
					</p:column>
				</p:dataTable>
			</p:panel>
			<p:panel id="backupSuppliers" header="备选中介"
				rendered="#{not empty bulletinHome3.instance.backupTrades}"
				style="margin-bottom:10px;">
				<p:outputLabel for="backupSupplier" value="备选中介名称："
					style="margin:5px 10px"></p:outputLabel>
				<h:outputText id="backupSupplier"
					value="#{bulletinHome3.instance.getBackUpSupplierNames()}" />
			</p:panel>
			
			<p:panel header="结项材料">
				<p:repeat var="_attr" value="#{bulletinHome3.instance.appliedDoneAttachments}" varStatus="_status">
					<li style="border:none">
						<p:link value="#{_status.index + 1}、#{_attr.filename}" target="_blank" ajax="false" href="#{attachmentUtils.getFullPath(_attr)}" />
					</li>
				</p:repeat>
			</p:panel>
			
			<p:button outcome="BulletinList.xhtml" value="完成"></p:button>
		</h:form>
		
		
	</ui:define>
</ui:composition>
